#include <stdio.h>
#include <stdlib.h>

int main(int argc, const char* argv[])
{
   int i = -1;
   char c1, c2;
   FILE *pi, *ref;
   
   ref = fopen("pi-ref.txt", "r");
   pi = fopen(argv[1], "r");
   
   while(1)
   {
      c1 = fgetc(pi);
      c2 = fgetc(ref);
      if(c1 == c2 || c2 == '0')
         i++;
      else
         break;
   }
   
   printf("%d\n", i);
   return 0;
}
